package test3;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class test {
    public static void main(String[] args){
        /*File f=new File("e:\\a.txt");
        try{
            FileInputStream fis=new FileInputStream(f);
            byte[] bytes=new byte[1024];
            int n;
            while(( n=fis.read(bytes))!=-1){
                String s=new String(bytes,0,n);
                System.out.println(s);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        */
        File f=new File("e:\\a.txt");
        FileOutputStream fos=null;
        try {
               fos=new FileOutputStream(f);
               String s="world\r\n";
               String s1="hello";
               byte[] bytes=new byte[1024];
               fos.write(s.getBytes());
               fos.write(s1.getBytes());
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                fos.close();
            }catch (Exception e){
                e.printStackTrace();
            }

        }
    }
}
